home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / qwik41.arc / QINIT.DOC < prev    next >
Text File  |  1989-06-12  |  17KB  |  321 lines

  1. { Qinit.doc - documentation for QWIK Qinit                  ver 4.1, 05-01-88 }
  2. {                                                                             }
  3. { Qinit initializes all the variables needed for the Q- procedures.  And      }
  4. { specifically checks for ALL IBM video equipment including dual monitors.    }
  5.  
  6.   This file will help you figure out how the new IBM PS/2 systems are config-
  7.   ured as well as original equipment.  First, it is helpful to have a list of 
  8.   all the possible Alphanumeric (A/N or text) modes.  QWIK was not designed 
  9.   for the All Points Addressable (APA or graphics) modes.  Qinit detects dual 
  10.   monitors and saves both the active and alternate display device codes.
  11.  
  12.             TABLE 1:  Hardware Specific Video Mode Characteristics
  13. Mode Format Segment Display Box  MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC MaxPage
  14. ---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
  15. 0,1  40x25  B800:0  320x200 8x8       x   x   x    x   x    x              7
  16.                     320x350 8x14          x        x                       7
  17.                     320x400 8x16              x                            7
  18.                     360x400 9x16                   x                       7
  19. 2,3  80x25  B800:0  640x200 8x8       x                x    x              3
  20.                     640x200 8x8           x        x                       7 *
  21.                     640x350 8x14          x        x                       7 *
  22.                     640x400 8x16              x                            7
  23.                     720x350 9x14                                x          0+
  24.                     720x400 9x16                   x                       7
  25. 7    80x25  B000:0  720x350 9x14  x                         x   x    x     0 
  26.                     720x350 9x14          x        x                       7 *
  27.                     720x400 9x16                   x                       7
  28.                     640x200 8x8                             x              3
  29.  
  30. Legend:
  31.   Format  - Characters per row by the number of rows in the data area.
  32.   Segment - Address of the first character on page 0 of the display buffer.
  33.   Display - The pixel resolution for the data area excluding the border, 
  34.             horizontal by vertical.
  35.   Box     - The pixel resolution for each character, horizontal by vertical.
  36.   MDA     - Monochrome Display and Printer Adapter
  37.   CGA     - Color Graphics Adapter 
  38.   EGA     - Enhanced Graphics Adapter
  39.   PGC     - Professional Graphics Controller
  40.   MCGA    - Multi-Color Graphics Array
  41.   VGA     - Video Graphics Array
  42.   PCjr    - PC Junior
  43.   PCC     - PC Convertible
  44.   HGC     - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
  45.   3270    - All IBM 3270 PC adapters
  46.   MaxPage - 0-based highest page number; e.g. 7 means there are 8 pages.
  47.   MD      - 5151 Monochrome Display
  48.   CD      - 5153 Color Display
  49.   ECD     - 5154 Enhanced Color Display
  50.  
  51. Notes:
  52.   1. The 0 and 2 modes suppress color burst only on composite displays (not 
  53.      RGB) only for CGA and EGA.
  54.   2. The PS/2 model 25 and 30 have an integrated MCGA.  The model 50 and 
  55.      above have an integrated VGA.
  56.   3. The 8514 High Content Color Display along with the 8514/A adapter 
  57.      produces a superset of the VGA for APA, but there is no differences in 
  58.      the A/N modes to the VGA when the adapter is in "VGA" mode.  See IBM 
  59.      documentation for Advanced Function Mode.
  60.   4. Reduced MaxPage to 3 if EGA only has 64K graphics memory installed for 
  61.      modes marked "*".  MaxPage of 7 is for 128K or more.
  62.   5. The PCC can have either an alternate MDA or CGA.  The LCD (model 5140) 
  63.      can emulate either the MDA or CGA modes, but the MDA mode is 640x200.
  64.   6. I currently have no information on the PGC.
  65.   7. To relieve cursor routine programming due to the multiple character box 
  66.      sizes, the VGA has a cursor emulation mode.  Qinit turns on the mode 
  67.      if PS/2 equipment is detected.  See CURSOR.DOC for emulation notes.
  68.   8. On the 3270 PC, dual monitors are not possible as they use the same 
  69.      physical buffer space.  Qinit will determine if more than just page 0 
  70.      is available for color displays.  Unless there is a special adapter, 
  71.      there is only page 0.
  72.  
  73.   Display Combination Code (DCC) - The PS/2 video BIOS has a new function 
  74.   that simplifies equipment detection called the Read/Write Display 
  75.   Combination Code.  Using interrupt $10 with AH = $1A00, the call will 
  76.   return the Active Display Device in BL and the Alternate Display Device in 
  77.   BH.  If the function is supported, it also returns $1A to AL.  The possible 
  78.   Display Device codes (as assigned by IBM) are: 
  79.  
  80.      TABLE 2:  Display Combination Code
  81.      CODE  DESCRIPTION                       QWIK41 Constant
  82.      ----  --------------------------------  ---------------
  83.      $00   No display                        NoDisplay
  84.      $01   MDA with 5151 monochrome display  MdaMono
  85.      $02   CGA with 5153/4 color display     CgaColor
  86.      $03   reserved                          DCC3
  87.      $04   EGA with 5153/4 color             EgaColor
  88.      $05   EGA with 5151 monochrome          EgaMono
  89.      $06   PGC with 5175 color               PgcColor
  90.      $07   VGA with analog monochrome        VgaMono
  91.      $08   VGA with analog color             VgaColor
  92.      $09 to $0A - reserved                   DCC9,DCC10
  93.      $0B   MCGA with analog monochrome       McgaMono
  94.      $0C   MCGA with analog color            McgaColor
  95.      $0D to $FE - reserved                   n/a
  96.      $FF   unknown                           Unknown
  97.  
  98.   Conforming to DCC - No results are obtained for the DCC on anything other 
  99.   than PS/2 equipment.  However, to be consistent, Qinit was reprogrammed 
  100.   to conform to the DCC for ALL equipment.  To see if a CGA is in use, 
  101.   simply check to see if ActiveDispDev=CgaColor.  Qinit only sets the 
  102.   parameters for the active display.  Although the alternate display device 
  103.   code is saved, it is only for testing purposes.  If you change text modes 
  104.   in a running program, Qinit should be executed again. 
  105.  
  106.   HavePS2 - Qinit sets HavePS2 to true if the DCC is supported.  This means 
  107. | that the program has detected a PS/2 video card whether it is a standard 
  108.   Model 30, a PS/2 Display Adapter on an IBM XT, or the like.  It also 
  109.   means that either MCGA or VGA is present, but not necessarily active.  To 
  110.   know which, just check the DCC.
  111.  
  112.   Have3270 - If Qinit detects 3270 PC equipment/software, this variable is 
  113.   set to true.  In addition, the ActiveDispDev is either MdaMono or 
  114.   CgaColor.  Note: There may or may not be graphics capability in either 
  115.   case; Qinit is not meant to detect graphics.  ActiveDispDev3270 may be 
  116.   one of the following:
  117.  
  118.      TABLE 3:  3270 PC Display Combination Code
  119.      CODE  MONITOR        ADAPTER                    QWIK41 Constant
  120.      ----  -------------- -------------------------  ---------------
  121.      $00   5151 or 5272   for 5151 or 5272           
  122.      $01   3295           for 3295
  123.      $02   5151 or 5272   for 5151 or 5272 plus
  124.                            XGA graphics
  125.      $03   5279           3270 PC G 
  126.      $04   5379 C01       3270 PC GX 
  127.      $05   5379 M01       3270 PC GX 
  128.      $06   Reserved
  129.      $07   Reserved
  130.      $FF   Unknown, not a 3270 PC                    Unknown
  131.  
  132.   EGA Switches - By checking the value of this byte, you can determine the 
  133.   monitor connected to the EGA, the alternate video system, and the start 
  134.   up default.  The byte is a copy of how the dip switches are set on the 
  135.   card where on=0 and off=1.  The primary is the default.  When the ECD is 
  136. | set for 640x200, it is emulating the CD including the cursor mode.  Qinit 
  137. | now directly tests for the alternate device rather than assuming it.
  138.  
  139.        TABLE 4: EGA dip switch configuration     
  140.        SWITCH  VALUE  PRIMARY               SECONDARY
  141.        ------  -----  --------------------  -------------------
  142.        0000    0      MDA + MD              EGA + CD - 40x25   
  143.        0001    1      MDA + MD              EGA + CD - 80x25   
  144.        0010    2      MDA + MD              EGA + ECD (640x200)
  145.        0011    3      MDA + MD              EGA + ECD (640x350)
  146.        0100    4      CGA + CD - 40x25      EGA + MD           
  147.        0101    5      CGA + CD - 80x25      EGA + MD           
  148.        0110    6      EGA + CD - 40x25      MDA + MD           
  149.        0111    7      EGA + CD - 80x25      MDA + MD           
  150.        1000    8      EGA + ECD (640x200)   MDA + MD           
  151.        1001    9      EGA + ECD (640x350)   MDA + MD           
  152.        1010   10      EGA + MD              CGA + CD - 40x25   
  153.        1011   11      EGA + MD              CGA + CD - 80x25   
  154.  
  155.   EGA Information - The byte located at $0040:$0087 has the following 
  156.   information when the EGA (or VGA) is present:
  157.  
  158.        TABLE 5: EGA information
  159.        BITS  DESCRIPTION
  160.        ----  -------------------------------------------------
  161.        7     (0) Clear, (1) Keep video data after mode set
  162.        6,5   (00) 64k, (01) 128k, (10) 192k, (11) 256k, memory
  163.        4     Reserved
  164.        3     (0) EGA active, (1) EGA not active
  165.        2     (0) Disable,    (1) Enable wait-for-display
  166.        1     (0) CD/ECD,     (1) MD attached
  167.        0     (0) Active,     (1) Inactive CD emulation
  168.  
  169.   PCC Exceptions - Since the PCC also does not support the DCC, a separate
  170.   code is used.  If the 5140 LCD is used in mode 7, the Active Display 
  171.   Device is set to MdaMono which is close enough.  This set up can be 
  172.   verified by testing if MaxPage=3.  The alternate display is found by using 
  173.   interrupt $10 with AH=$15.  The result is saved in AltDispDevPCC.  Of 
  174.   course the variable is undefined if a PCC is not used.  The possible types 
  175.   are:
  176.  
  177.      TABLE 6: PC Convertible Alternate Display Adapters
  178.      VARIABLE        MODEL  DESCRIPTION
  179.      -------------   -----  --------------------
  180.      AltDispDevPCC = $   0   No alternate adapter
  181.                    = $5140   LCD
  182.                    = $5153   CGA type
  183.                    = $5151   Monochrome type
  184.  
  185.   Dual Monitors - Qinit makes an attempt to detect for a second monitor by 
  186. | several means.  If no alternate cards like EGA or VGA are found, an 
  187. | alternate 6845 video chip (CGA, MDA, or Hercules) is checked.  If the 
  188. | chip is found, then further tests are made to find which card it could 
  189. | be.  The chip existence test is highly reliable.  If no alternate display 
  190. | device is found, then AltDispDev=NoDisplay.
  191.  
  192. | Hercules - Hercules cards are also detected.  If either the active or 
  193. | alternate DCC is MdaMono, which is found by verifying a responsive 6845 
  194. | video chip at the mono register port, then an attempt is made to find if 
  195. | any Hercules card is attached.  If no Hercules card is found, then 
  196. | HercModel=NoHerc; it is then assumed that just an MDA card is attached.  
  197. | This test is only run once, even if Qinit is executed again, because the 
  198. | test can take up to 1/3 of a second on slower computers.  The tests for 
  199.   the Hercules cards are the ones recommended by Hercules Computer 
  200.   Technology, which also admits that sometimes the tests will fail during 
  201.   multi-tasking activity.  Hercules clones may not be detected by these 
  202.   test, but the DCC will be correct.
  203.  
  204.      TABLE 7:  HercModel - Hercules Model Code
  205.      CODE  DESCRIPTION                       QWIK41 Constant
  206.      ----  --------------------------------  ---------------
  207.       0    No Hercules card                  NoHerc
  208.       1    HGC                               HgcMono
  209.       2    HGC Plus                          HgcPlus
  210.       3    Hercules InColor Card             HercInColor
  211.  
  212.   System Identification - To get both the model and submodel, you must use 
  213. | interrupt $15 with AH=$C0 which only works on some computers.  The code 
  214. | was modified to properly exit on AT&T, Leading Edge, and other clones 
  215. | which have BIOS inconsistencies.  If the carry flag is set on exit, then 
  216.   that interrupt is not supported, because there's no submodel number.  The 
  217.   alternative is to get the basic computer model by directly accessing the 
  218.   byte in memory at $F000:$FFFE.  The possible values are:
  219.  
  220.  
  221.      TABLE 8:  System Identification Codes
  222.      SysID Sub-Model  SYSTEM              
  223.      ----- ---------  ---------------------------
  224.       $FF    n/a      IBM PC
  225.       $FE    n/a      IBM PC XT
  226.       $FD    n/a      IBM PCjr
  227.       $FC    n/a      IBM PC AT (6 MHz, 01/10/84)
  228.              $00      IBM PC AT (6 MHz, 06/10/85)
  229.              $01      IBM PC AT (8 MHz, 11/15/85)
  230.              $02      IBM PC XT (286)
  231.              $04      IBM PS/2 model 50
  232.              $05      IBM PS/2 model 60
  233.       $FB    $00      IBM PC XT (256/640)
  234.       $FA    $00      IBM PS/2 model 30
  235.              $01      IBM PS/2 model 25
  236.       $F9    $00      IBM PC Convertible
  237.       $F8    $00      IBM PS/2 model 80 (16 MHz)
  238.              $01      IBM PS/2 model 80 (20 MHz)
  239.  
  240. | CPU Identification - A CPU detection routine has been included for Intel  
  241. | processors.  This routine is independent of QWIK and is useful for clones 
  242. | that do not recognize IBM's system ID scheme.  The idea came from Juan 
  243. | Jimenez as it appeared in Jan/Feb '88 Turbo Technix magazine.  The 
  244. | routine has been simplified for reduced code (only 42 bytes) and allows 
  245. | use of simple constant identifiers.  Therefore, this routine is optional 
  246. | to  QWIK and may be deleted from the initialization in QWIKxx.PAS if 
  247. | desired.
  248.  
  249. |    TABLE 9:  Intel CPU Identification
  250. |    INTEL CPU MODEL NUMBERS  QWIK41 Constant
  251. |    -----------------------  ---------------
  252. |    Intel 8086/8088          Cpu8086
  253. |    Intel 80186/80188        Cpu80186
  254. |    Intel 80286              Cpu80286
  255. |    Intel 80386              Cpu80386
  256.  
  257.   The essential variables set by Qinit are:
  258.  
  259.     VARIABLE      DESCRIPTION
  260.     ------------  ---------------------------------------------------------
  261.     Page0seg      Segment for the base page, page 0.  This value may be
  262.                     changed for multi-tasking environments.
  263.     Qseg          Segment for Q writing which is altered when changing
  264.                     pages.
  265.     Qsnow         Wait-for-retrace (snow) while Q writing.
  266.     MaxPage       Maximum possible 0-based page number.
  267.  
  268.   The other variables set or located by Qinit are for your reference to 
  269.   help make decisions in your programs:  
  270.  
  271.     VARIABLE      DESCRIPTION
  272.     ------------  ---------------------------------------------------------
  273.     VideoMode     Directly accesses the video mode code.
  274.     VideoPage     Directly accesses the video page number.
  275.     EgaRows       0-based number of rows on the screen for EGA or VGA.
  276.     EgaFontSize   1-based number of horizontal scan lines per character for
  277.                     EGA or VGA.
  278.     EgaInfo       (Described above)
  279.     EgaSwithces   (Described above)
  280.     CRTcolumns    1-based number of CRT columns for any card or video mode.
  281.     CRTcols       Global variable equal to CRTcolumns.
  282.     CRTrows       1-based number of CRT rows for any card or video mode.
  283. |   QnextOfs      0-based offset where next Q*More procedure will write.
  284.     HavePS2       Detects the presence of IBM PS/2 video equipment.
  285.     Have3270      Detects the presence IBM 3270 PC equipment/software.
  286.     CardSeg       Video buffer address the video "card".
  287.     CardSnow      Requirement for wait-for-retrace for the video "card".
  288.     SystemID      Code for the IBM computer in use.
  289.     SubModelID    Code for the sub-model of the IBM computer in use.
  290. |   CpuID         Intel CPU identification code.
  291.     ActiveDispDev Code for the Active Display Device.
  292.     AltDispDev    Code for the Alternate Display Device.
  293.     AltDispDevPCC Code for the Alternate Display adapter on the PC 
  294.                     Convertible.
  295.     ActiveDispDev3270 Code for the Active Display Device on the 3270 PC.
  296.     
  297.   CGA Snow - A recent discovery has shown that CGA cards do not need wait-
  298.   for-retrace in 40 column modes 0 and 1.  Qinit was programmed to 
  299.   accommodate this.  For other hardware, you can change Qsnow to suit your 
  300.   needs, but CardSnow should be left unchanged to save what Qinit detected. 
  301.  
  302.   References - For more information on the new IBM PS/2 system, you can get 
  303.   the "IBM BIOS Interface Technical Reference Manual".  Other references 
  304.   include:
  305.     
  306.      IBM Personal System/2 Seminar Proceedings:
  307.        Volume 5, Number 2, Displays and Adapters, publication # G360-2678.
  308.        Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and Programming 
  309.           Considerations, publication # G360-2747.
  310.  
  311.   For more information on the IBM 3270 PC, you can get the the following 
  312.   publications:
  313.  
  314.     "3270 PC Application Development Considerations"
  315.     "IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
  316.     "IBM 3270 Personal Computer Control Program Reference", Pub # GA23-0232
  317.  
  318.   As always, the above information is subject to change without notice per 
  319.   IBM.  IBM is the trademark for International Business Machines Corp. (but 
  320.   you already know that!)
  321.